﻿
using System.Windows;
using System.Windows.Controls;



namespace Company.Shell.Controls
{
    /// <summary>
    /// ADU.xaml 的交互逻辑
    /// </summary>
    public partial class ADU : UserControl
    {
        public ADU()
        {
            InitializeComponent();
        }

        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(string), typeof(ADU), new PropertyMetadata("", new PropertyChangedCallback(TextChangeCallback)));

        private static void TextChangeCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var control = (ADU)d;
            if (control == null)
            {
                return;
            }
            if (e.NewValue is string text)
            {
                control._text.Text = text;
            }

        }
    }
}
